home *** CD-ROM | disk | FTP | other *** search
- unit Unit1;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls, Buttons;
-
- type
- TForm1 = class(TForm)
- Memo1: TMemo;
- Edit1: TEdit;
- Edit2: TEdit;
- BitBtn1: TBitBtn;
- procedure BitBtn1Click(Sender: TObject);
- private
- { Private-Deklarationen }
- public
- { Public-Deklarationen }
- end;
-
- var
- Form1: TForm1;
- a,i:integer;
- b:PChar;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.BitBtn1Click(Sender: TObject);
- begin
- a:=0;
- b:=PChar(Edit1.Text);
- if StrLen(b)<4 then Application.MessageBox('Wrong Code','Sorry',MB_OK)
- else
- begin
- a:=integer(Edit1.Text[1])*12+integer(Edit1.Text[2])*25+integer(Edit1.Text[3])*2+integer(Edit1.Text[4])*11;
- a:=a*a*StrLen(b);
- if IntToStr(a)=Edit2.Text then Application.MessageBox('You did it','Congratulations',MB_OK)
- else Application.MessageBox('Wrong Code','Sorry',MB_OK);
- //Edit2.Text:=IntToStr(a);
- end;
- end;
-
- end.
-